-
-
Notifications
You must be signed in to change notification settings - Fork 502
Fix HttpServerResponse.fromWeb losing Content-Type header #5940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tim-smart
merged 1 commit into
main
from
fix/http-server-response-from-web-content-type
Dec 31, 2025
Merged
Fix HttpServerResponse.fromWeb losing Content-Type header #5940
tim-smart
merged 1 commit into
main
from
fix/http-server-response-from-web-content-type
Dec 31, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When converting a web Response to HttpServerResponse via fromWeb, the Content-Type header was not being passed to Body.stream(), causing it to default to "application/octet-stream". This affected any code using HttpApp.fromWebHandler to wrap web handlers, as JSON responses would incorrectly have their Content-Type set to "application/octet-stream" instead of "application/json". Added tests to verify Content-Type preservation in both toWebHandler and fromWebHandler round-trips.
🦋 Changeset detectedLatest commit: 1e1cac7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 31 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Author
|
Here's an example of the problem in context. |
tim-smart
approved these changes
Dec 31, 2025
Merged
Thiladev
pushed a commit
to Thiladev/effect-fc
that referenced
this pull request
Jan 16, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [@effect/language-service](https://github.com/Effect-TS/language-service) | [`^0.60.0` → `^0.65.0`](https://renovatebot.com/diffs/npm/@effect%2flanguage-service/0.60.0/0.65.0) |  |  | | [@effect/platform](https://effect.website) ([source](https://github.com/Effect-TS/effect/tree/HEAD/packages/platform)) | [`^0.93.6` → `^0.94.0`](https://renovatebot.com/diffs/npm/@effect%2fplatform/0.93.8/0.94.1) |  |  | | [@effect/platform-browser](https://effect.website) ([source](https://github.com/Effect-TS/effect/tree/HEAD/packages/platform-browser)) | [`^0.73.0` → `^0.74.0`](https://renovatebot.com/diffs/npm/@effect%2fplatform-browser/0.73.0/0.74.0) |  |  | --- ### Release Notes <details> <summary>Effect-TS/language-service (@​effect/language-service)</summary> ### [`v0.65.0`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0650) [Compare Source](Effect-TS/language-service@v0.64.1...v0.65.0) ##### Minor Changes - [#​581](Effect-TS/language-service#581) [`4569328`](Effect-TS/language-service@4569328) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add `effectFnOpportunity` diagnostic that suggests converting functions returning `Effect.gen` to `Effect.fn` for better tracing and concise syntax. The diagnostic triggers on: - Arrow functions returning `Effect.gen(...)` - Function expressions returning `Effect.gen(...)` - Function declarations returning `Effect.gen(...)` - Functions with `Effect.gen(...).pipe(...)` patterns It provides two code fixes: - Convert to `Effect.fn` (traced) - includes the function name as the span name - Convert to `Effect.fnUntraced` - without tracing The diagnostic skips: - Generator functions (can't be converted) - Named function expressions (typically used for recursion) - Functions with multiple call signatures (overloads) When the original function has a return type annotation, the converted function will use `Effect.fn.Return<A, E, R>` as the return type. Example: ```ts // Before export const myFunction = (a: number) => Effect.gen(function* () { yield* Effect.succeed(1); return a; }); // After (with Effect.fn) export const myFunction = Effect.fn("myFunction")(function* (a: number) { yield* Effect.succeed(1); return a; }); // Before (with pipe) export const withPipe = () => Effect.gen(function* () { return yield* Effect.succeed(1); }).pipe(Effect.withSpan("withPipe")); // After (with Effect.fn) export const withPipe = Effect.fn("withPipe")(function* () { return yield* Effect.succeed(1); }, Effect.withSpan("withPipe")); ``` - [#​575](Effect-TS/language-service#575) [`00aeed0`](Effect-TS/language-service@00aeed0) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add `effectMapVoid` diagnostic that suggests using `Effect.asVoid` instead of `Effect.map(() => void 0)`, `Effect.map(() => undefined)`, or `Effect.map(() => {})`. Also adds two new TypeParser utilities: - `lazyExpression`: matches zero-argument arrow functions or function expressions that return a single expression - `emptyFunction`: matches arrow functions or function expressions with an empty block body And adds `isVoidExpression` utility to TypeScriptUtils for detecting `void 0` or `undefined` expressions. Example: ```ts // Before Effect.succeed(1).pipe(Effect.map(() => void 0)); Effect.succeed(1).pipe(Effect.map(() => undefined)); Effect.succeed(1).pipe(Effect.map(() => {})); // After (suggested fix) Effect.succeed(1).pipe(Effect.asVoid); ``` - [#​582](Effect-TS/language-service#582) [`94d4a6b`](Effect-TS/language-service@94d4a6b) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Added `layerinfo` CLI command that provides detailed information about a specific exported layer. Features: - Shows layer type, location, and description - Lists services the layer provides and requires - Suggests optimal layer composition order using `Layer.provide`, `Layer.provideMerge`, and `Layer.merge` Example usage: ```bash effect-language-service layerinfo --file ./src/layers/app.ts --name AppLive ``` Also added a tip to both `overview` and `layerinfo` commands about using `Layer.mergeAll(...)` to get suggested composition order. - [#​583](Effect-TS/language-service#583) [`b0aa78f`](Effect-TS/language-service@b0aa78f) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add `redundantSchemaTagIdentifier` diagnostic that suggests removing redundant identifier arguments when they equal the tag value in `Schema.TaggedClass`, `Schema.TaggedError`, or `Schema.TaggedRequest`. **Before:** ```typescript class MyError extends Schema.TaggedError<MyError>("MyError")("MyError", { message: Schema.String, }) {} ``` **After applying the fix:** ```typescript class MyError extends Schema.TaggedError<MyError>()("MyError", { message: Schema.String, }) {} ``` Also updates the completions to not include the redundant identifier when autocompleting `Schema.TaggedClass`, `Schema.TaggedError`, and `Schema.TaggedRequest`. - [#​573](Effect-TS/language-service#573) [`6715f91`](Effect-TS/language-service@6715f91) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Rename `reportSuggestionsAsWarningsInTsc` option to `includeSuggestionsInTsc` and change default to `true`. This option controls whether diagnostics with "suggestion" severity are included in TSC output when using the `effect-language-service patch` feature. When enabled, suggestions are reported as messages in TSC output, which is useful for LLM-based development tools to see all suggestions. **Breaking change**: The option has been renamed and the default behavior has changed: - Old: `reportSuggestionsAsWarningsInTsc: false` (suggestions not included by default) - New: `includeSuggestionsInTsc: true` (suggestions included by default) To restore the previous behavior, set `"includeSuggestionsInTsc": false` in your tsconfig.json plugin configuration. - [#​586](Effect-TS/language-service#586) [`e225b5f`](Effect-TS/language-service@e225b5f) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add markdown documentation support to setup command The setup command now automatically manages Effect Language Service documentation in AGENTS.md and CLAUDE.md files: - When installing: Adds or updates the Effect Language Service section with markers - When uninstalling: Removes the section if present - Case-insensitive file detection (supports both lowercase and uppercase filenames) - Skips symlinked files to avoid modifying linked content - Shows proper diff view for markdown file changes Example section added to markdown files: ```markdown <!-- effect-language-service:start --> ## Effect Language Service The Effect Language Service comes in with a useful CLI that can help you with commands to get a better understanding your Effect Layers and Services, and to help you compose them correctly. <!-- effect-language-service:end --> ``` ##### Patch Changes - [#​580](Effect-TS/language-service#580) [`a45606b`](Effect-TS/language-service@a45606b) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add `Effect.fn` and `Effect.fnUntraced` support to the piping flows parser. The piping flows parser now recognizes pipe transformations passed as additional arguments to `Effect.fn`, `Effect.fn("traced")`, and `Effect.fnUntraced`. This enables diagnostics like `catchAllToMapError`, `catchUnfailableEffect`, and `multipleEffectProvide` to work with these patterns. Example: ```ts // This will now trigger the catchAllToMapError diagnostic const example = Effect.fn( function* () { return yield* Effect.fail("error"); }, Effect.catchAll((cause) => Effect.fail(new MyError(cause))) ); ``` - [#​587](Effect-TS/language-service#587) [`7316859`](Effect-TS/language-service@7316859) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Mark deprecated TypeScript Signature methods and migrate to property accessors Added `@deprecated` annotations to TypeScript Signature interface methods (`getParameters`, `getTypeParameters`, `getDeclaration`, `getReturnType`, `getTypeParameterAtPosition`) with guidance to use their modern property alternatives. Updated codebase usage of `getParameters()` to use `.parameters` property instead. - [#​584](Effect-TS/language-service#584) [`ed12861`](Effect-TS/language-service@ed12861) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Fix TypeError in setup command when updating existing diagnosticSeverity configuration The setup command was throwing `TypeError: Cannot read properties of undefined (reading 'text')` when trying to update the `diagnosticSeverity` option of an existing `@effect/language-service` plugin configuration in tsconfig.json. This occurred because TypeScript's ChangeTracker formatter needed to compute indentation by traversing the AST tree, which failed when replacing a PropertyAssignment node inside a nested list context. The fix replaces just the initializer value (ObjectLiteralExpression) instead of the entire PropertyAssignment, avoiding the problematic list indentation calculation. - [#​585](Effect-TS/language-service#585) [`7ebe5db`](Effect-TS/language-service@7ebe5db) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Enhanced `layerinfo` CLI command with output type selection for layer composition. **New Features:** - Added `--outputs` option to select which output types to include in the suggested composition (e.g., `--outputs 1,2,3`) - Shows all available output types from the layer graph with indexed checkboxes - By default, only types that are in the layer's declared `ROut` are selected - Composition code now includes `export const <name> = ...` prefix for easy copy-paste **Example output:** ``` Suggested Composition: Not sure you got your composition right? Just write all layers inside a Layer.mergeAll(...) then run this command again and use --outputs to select which outputs to include in composition. Example: --outputs 1,2,3 [ ] 1. Cache [x] 2. UserRepository export const simplePipeIn = UserRepository.Default.pipe( Layer.provide(Cache.Default) ) ``` This allows users to see all available outputs from a layer composition and choose which ones to include in the suggested composition order. - [#​577](Effect-TS/language-service#577) [`0ed50c3`](Effect-TS/language-service@0ed50c3) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Refactor `catchAllToMapError` diagnostic to use the piping flows parser for detecting Effect.catchAll calls. This change also: - Makes `outType` optional in `ParsedPipingFlowSubject` to handle cases where type information is unavailable - Sorts piping flows by position for consistent ordering - [#​578](Effect-TS/language-service#578) [`cab6ce8`](Effect-TS/language-service@cab6ce8) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - refactor: use piping flows parser in catchUnfailableEffect diagnostic - [#​579](Effect-TS/language-service#579) [`2a82522`](Effect-TS/language-service@2a82522) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - refactor: use piping flows parser in multipleEffectProvide diagnostic - [#​570](Effect-TS/language-service#570) [`0db6e28`](Effect-TS/language-service@0db6e28) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Refactor CLI overview command to extract symbol collection logic into reusable utility - Extract `collectSourceFileExportedSymbols` into `src/cli/utils/ExportedSymbols.ts` for reuse across CLI commands - Add `--max-symbol-depth` option to overview command (default: 3) to control how deep to traverse nested symbol properties - Add tests for the overview command with snapshot testing - [#​574](Effect-TS/language-service#574) [`9d0695e`](Effect-TS/language-service@9d0695e) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Remove deprecated ts-patch documentation from README. The Effect LSP CLI Patch is now the only recommended approach for getting diagnostics at compile time. - [#​576](Effect-TS/language-service#576) [`5017d75`](Effect-TS/language-service@5017d75) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add piping flows parser for caching piping flow analysis per source file. This internal improvement introduces a `pipingFlows` function in `TypeParser` that analyzes and caches all piping flows (both `pipe()` calls and `.pipe()` method chains) in a source file. The parser: - Identifies piping flows including nested pipes and mixed call styles (e.g., `Effect.map(effect, fn).pipe(...)`) - Tracks the subject, transformations, and intermediate types for each flow - Enables more efficient diagnostic implementations by reusing cached analysis The `missedPipeableOpportunity` diagnostic has been refactored to use this new parser, improving performance when analyzing files with multiple piping patterns. ### [`v0.64.1`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0641) [Compare Source](Effect-TS/language-service@v0.64.0...v0.64.1) ##### Patch Changes - [#​568](Effect-TS/language-service#568) [`477271d`](Effect-TS/language-service@477271d) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Fix auto-import with namespace import packages generating malformed code when the identifier is at the beginning of the file. When using `namespaceImportPackages` configuration and auto-completing an export like `isAnyKeyword` from `effect/SchemaAST`, the code was incorrectly generated as: ```ts SchemaAST.import * as SchemaAST from "effect/SchemaAST"; ``` Instead of the expected: ```ts import * as SchemaAST from "effect/SchemaAST"; SchemaAST.isAnyKeyword; ``` The fix ensures the import statement is added before the namespace prefix when both changes target position 0. ### [`v0.64.0`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0640) [Compare Source](Effect-TS/language-service@v0.63.2...v0.64.0) ##### Minor Changes - [#​567](Effect-TS/language-service#567) [`dcb3fe5`](Effect-TS/language-service@dcb3fe5) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Added new diagnostic `catchAllToMapError` that suggests using `Effect.mapError` instead of `Effect.catchAll` + `Effect.fail` when the callback only wraps the error. Before: ```ts Effect.catchAll((cause) => Effect.fail(new MyError(cause))); ``` After: ```ts Effect.mapError((cause) => new MyError(cause)); ``` The diagnostic includes a quick fix that automatically transforms the code. - [#​555](Effect-TS/language-service#555) [`0424000`](Effect-TS/language-service@0424000) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add `globalErrorInEffectCatch` diagnostic to detect global Error types in catch callbacks This new diagnostic warns when catch callbacks in `Effect.tryPromise`, `Effect.try`, `Effect.tryMap`, or `Effect.tryMapPromise` return the global `Error` type instead of typed errors. Using the global `Error` type in Effect failures is not recommended as they can get merged together, making it harder to distinguish between different error cases. Instead, it's better to use tagged errors (like `Data.TaggedError`) or custom errors with discriminator properties to enable proper type checking and error handling. Example of code that triggers the diagnostic: ```typescript Effect.tryPromise({ try: () => fetch("http://example.com"), catch: () => new Error("Request failed"), //⚠️ Warning: returns global Error type }); ``` Recommended approach: ```typescript class FetchError extends Data.TaggedError("FetchError")<{ cause: unknown; }> {} Effect.tryPromise({ try: () => fetch("http://example.com"), catch: (e) => new FetchError({ cause: e }), // ✅ Uses typed error }); ``` This diagnostic also improves the clarity message for the `leakingRequirements` diagnostic by adding additional guidance on how services should be collected in the layer creation body. - [#​558](Effect-TS/language-service#558) [`cc5feb1`](Effect-TS/language-service@cc5feb1) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add `layerMergeAllWithDependencies` diagnostic to detect interdependencies in `Layer.mergeAll` calls This new diagnostic warns when `Layer.mergeAll` is called with layers that have interdependencies, where one layer provides a service that another layer in the same call requires. `Layer.mergeAll` creates layers in parallel, so dependencies between layers will not be satisfied. This can lead to runtime errors when trying to use the merged layer. Example of code that triggers the diagnostic: ```typescript export class DbConnection extends Effect.Service<DbConnection>()( "DbConnection", { succeed: {}, } ) {} export class FileSystem extends Effect.Service<FileSystem>()("FileSystem", { succeed: {}, }) {} export class Cache extends Effect.Service<Cache>()("Cache", { effect: Effect.as(FileSystem, {}), // Cache requires FileSystem }) {} //⚠️ Warning on FileSystem.Default const layers = Layer.mergeAll( DbConnection.Default, FileSystem.Default, // This provides FileSystem Cache.Default // This requires FileSystem ); ``` Recommended approach: ```typescript // Provide FileSystem separately before merging const layers = Layer.mergeAll(DbConnection.Default, Cache.Default).pipe( Layer.provideMerge(FileSystem.Default) ); ``` The diagnostic correctly handles pass-through layers (layers that both provide and require the same type) and only reports on layers that actually provide dependencies needed by other layers in the same `mergeAll` call. - [#​557](Effect-TS/language-service#557) [`83ce411`](Effect-TS/language-service@83ce411) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add `missingLayerContext` diagnostic to detect missing service requirements in Layer definitions This new diagnostic provides better error readability when you're missing service requirements in your Layer type definitions. It works similarly to the existing `missingEffectContext` diagnostic but specifically checks the `RIn` (requirements input) parameter of Layer types. Example of code that triggers the diagnostic: ```typescript import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; class ServiceA extends Effect.Service<ServiceA>()("ServiceA", { succeed: { a: 1 }, }) {} class ServiceB extends Effect.Service<ServiceB>()("ServiceB", { succeed: { a: 2 }, }) {} declare const layerWithServices: Layer.Layer<ServiceA, never, ServiceB>; function testFn(layer: Layer.Layer<ServiceA>) { return layer; } //⚠️ Error: Missing 'ServiceB' in the expected Layer context. testFn(layerWithServices); ``` The diagnostic helps catch type mismatches early by clearly indicating which service requirements are missing when passing layers between functions or composing layers together. - [#​562](Effect-TS/language-service#562) [`57d5af2`](Effect-TS/language-service@57d5af2) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add `overview` CLI command that provides an overview of Effect-related exports in a project. The command analyzes TypeScript files and reports all exported yieldable errors, services (Context.Tag, Effect.Tag, Effect.Service), and layers with their types, file locations, and JSDoc descriptions. A progress spinner shows real-time file processing status. Usage: ```bash effect-language-service overview --file path/to/file.ts effect-language-service overview --project tsconfig.json ``` Example output: ``` ✔ Processed 3 file(s) Overview for 3 file(s). Yieldable Errors (1) NotFoundError ./src/errors.ts:5:1 NotFoundError Services (2) DbConnection ./src/services/db.ts:6:1 Manages database connections Layers (1) AppLive ./src/layers/app.ts:39:14 Layer<Cache | UserRepository, never, never> ``` ##### Patch Changes - [#​561](Effect-TS/language-service#561) [`c3b3bd3`](Effect-TS/language-service@c3b3bd3) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add descriptions to CLI commands using `Command.withDescription` for improved help output when using `--help` flag. - [#​565](Effect-TS/language-service#565) [`2274aef`](Effect-TS/language-service@2274aef) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Fix `unnecessaryPipe` diagnostic and refactor not working with namespace imports from `effect/Function` (e.g., `Function.pipe()` or `Fn.pipe()`) - [#​560](Effect-TS/language-service#560) [`75a480e`](Effect-TS/language-service@75a480e) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Improve diagnostic message for `unsupportedServiceAccessors` when used with `Effect.Tag` When the `unsupportedServiceAccessors` diagnostic is triggered on an `Effect.Tag` class (which doesn't allow disabling accessors), the message now includes a helpful suggestion to use `Context.Tag` instead: ```typescript export class MyService extends Effect.Tag("MyService")< MyService, { method: <A>(value: A) => Effect.Effect<A>; } >() {} // Diagnostic: Even if accessors are enabled, accessors for 'method' won't be available // because the signature have generic type parameters or multiple call signatures. // Effect.Tag does not allow to disable accessors, so you may want to use Context.Tag instead. ``` - [#​559](Effect-TS/language-service#559) [`4c1f809`](Effect-TS/language-service@4c1f809) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Improve Layer Magic refactor ordering by considering both provided and required service counts The Layer Magic refactor now uses a combined ordering heuristic that considers both: 1. The number of services a layer provides 2. The number of services a layer requires This results in more optimal layer composition order, especially in complex dependency graphs where layers have varying numbers of dependencies. - [#​566](Effect-TS/language-service#566) [`036c491`](Effect-TS/language-service@036c491) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Simplify diagnostic messages for global Error type usage The diagnostic messages for `globalErrorInEffectCatch` and `globalErrorInEffectFailure` now use the more generic term "tagged errors" instead of "tagged errors (Data.TaggedError)" to provide cleaner, more concise guidance. ### [`v0.63.2`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0632) [Compare Source](Effect-TS/language-service@v0.63.1...v0.63.2) ##### Patch Changes - [#​553](Effect-TS/language-service#553) [`e64e3df`](Effect-TS/language-service@e64e3df) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - fix: ensure correct path resolution in CLI setup - Use `process.cwd()` explicitly in `path.resolve()` for consistent behavior - Resolve the selected tsconfig path to an absolute path before validation - Simplify error handling by using direct `yield*` for `TsConfigNotFoundError` ### [`v0.63.1`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0631) [Compare Source](Effect-TS/language-service@v0.63.0...v0.63.1) ##### Patch Changes - [#​551](Effect-TS/language-service#551) [`9b3d807`](Effect-TS/language-service@9b3d807) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - fix: resolve TypeScript from project's working directory The CLI now attempts to resolve TypeScript from the current working directory first before falling back to the package's bundled version. This ensures the CLI uses the same TypeScript version as the project being analyzed. ### [`v0.63.0`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0630) [Compare Source](Effect-TS/language-service@v0.62.5...v0.63.0) ##### Minor Changes - [#​548](Effect-TS/language-service#548) [`ef8c2de`](Effect-TS/language-service@ef8c2de) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add `globalErrorInEffectFailure` diagnostic This diagnostic warns when `Effect.fail` is called with the global `Error` type. Using the global `Error` type in Effect failures is not recommended as they can get merged together, making it harder to distinguish between different error types. Instead, the diagnostic recommends using: - Tagged errors with `Data.TaggedError` - Custom error classes with a discriminator property (like `_tag`) Example: ```ts // This will trigger a warning Effect.fail(new Error("global error")); // These are recommended alternatives Effect.fail(new CustomError()); // where CustomError extends Data.TaggedError Effect.fail(new MyError()); // where MyError has a _tag property ``` - [#​545](Effect-TS/language-service#545) [`c590b5a`](Effect-TS/language-service@c590b5a) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add `effect-language-service setup` CLI command This new command provides an interactive wizard to guide users through the complete installation and configuration of the Effect Language Service. The setup command: - Analyzes your repository structure (package.json, tsconfig files) - Guides you through adding the package to devDependencies - Configures the TypeScript plugin in your tsconfig.json - Allows customizing diagnostic severity levels - Optionally adds prepare script for automatic patching - Optionally configures VS Code settings for workspace TypeScript usage - Shows a review of all changes before applying them Example usage: ```bash effect-language-service setup ``` The wizard will walk you through each step and show you exactly what changes will be made before applying them. - [#​550](Effect-TS/language-service#550) [`4912ee4`](Effect-TS/language-service@4912ee4) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add support for `@effect/sql`'s `Model.Class` in completions and diagnostics - Added `effectSqlModelSelfInClasses` completion: Auto-completes the `Self` type parameter when extending `Model.Class` from `@effect/sql` - Extended `classSelfMismatch` diagnostic: Now detects when the `Self` type parameter in `Model.Class<Self>` doesn't match the actual class name Example: ```ts import { Model } from "@​effect/sql"; import * as Schema from "effect/Schema"; // Completion triggers after "Model." to generate the full class boilerplate export class User extends Model.Class<User>("User")({ id: Schema.String, }) {} // Diagnostic warns when Self type parameter doesn't match class name export class User extends Model.Class<WrongName>("User")({ // ^^^^^^^^^ Self type should be "User" id: Schema.String, }) {} ``` ##### Patch Changes - [#​547](Effect-TS/language-service#547) [`9058a37`](Effect-TS/language-service@9058a37) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - refactor: simplify `unnecessaryFailYieldableError` diagnostic implementation Changed the implementation to check if a type extends `Cause.YieldableError` on-demand rather than fetching all yieldable error types upfront. - [#​549](Effect-TS/language-service#549) [`039f4b2`](Effect-TS/language-service@039f4b2) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add `getTypeAtLocation` utility to `TypeCheckerUtils` This refactoring adds a new `getTypeAtLocation` function to `TypeCheckerUtils` that safely retrieves types while filtering out JSX-specific nodes (JSX elements, opening/closing tags, and JSX attributes) that could cause issues when calling `typeChecker.getTypeAtLocation`. The utility is now used across multiple diagnostics and features, reducing code duplication and ensuring consistent handling of edge cases: - `anyUnknownInErrorContext` - `catchUnfailableEffect` - `floatingEffect` - `globalErrorInEffectFailure` - `leakingRequirements` - `missedPipeableOpportunity` - `missingEffectServiceDependency` - `missingReturnYieldStar` - `multipleEffectProvide` - `nonObjectEffectServiceType` - `overriddenSchemaConstructor` - `returnEffectInGen` - `scopeInLayerEffect` - `strictBooleanExpressions` - `strictEffectProvide` - `unnecessaryFailYieldableError` - And other features like quick info, goto definition, and refactors ### [`v0.62.5`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0625) [Compare Source](Effect-TS/language-service@v0.62.4...v0.62.5) ##### Patch Changes - [#​543](Effect-TS/language-service#543) [`0b13f3c`](Effect-TS/language-service@0b13f3c) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Fix unwanted autocompletions inside import declarations Previously, Effect.**, Option.**, and Either.\_\_ completions were incorrectly suggested inside import statements. This has been fixed by detecting when the completion is requested inside an import declaration and preventing these completions from appearing. Closes [#​541](Effect-TS/language-service#541) ### [`v0.62.4`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0624) [Compare Source](Effect-TS/language-service@v0.62.3...v0.62.4) ##### Patch Changes - [#​539](Effect-TS/language-service#539) [`4cc88d2`](Effect-TS/language-service@4cc88d2) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Improve layerMagic refactor to prioritize layers with more provided services The layerMagic refactor now uses a heuristic that prioritizes nodes with more provided services when generating layer composition code. This ensures that telemetry and tracing layers (which typically provide fewer services) are positioned as late as possible in the dependency graph, resulting in more intuitive and correct layer ordering. Example: When composing layers for services that depend on HttpClient with telemetry, the refactor now correctly places the telemetry layer (which provides fewer services) later in the composition chain. ### [`v0.62.3`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0623) [Compare Source](Effect-TS/language-service@v0.62.2...v0.62.3) ##### Patch Changes - [#​537](Effect-TS/language-service#537) [`e31c03b`](Effect-TS/language-service@e31c03b) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Fix counter increment timing in structural type to schema refactor to ensure proper naming of conflicting schemas (e.g., `User_1` instead of `User_0` for the first conflict) ### [`v0.62.2`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0622) [Compare Source](Effect-TS/language-service@v0.62.1...v0.62.2) ##### Patch Changes - [#​535](Effect-TS/language-service#535) [`361fc1e`](Effect-TS/language-service@361fc1e) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Fix duplicate schema names in "Refactor to Schema (Recursive Structural)" code generation. When the refactor encountered types with conflicting names, it was generating a unique suffix but not properly tracking the usage count, causing duplicate schema identifiers with different contents to be generated. This fix ensures that when a name conflict is detected and a unique suffix is added (e.g., `Tax`, `Tax_1`, `Tax_2`), the usage counter is properly incremented to prevent duplicate identifiers in the generated code. Fixes [#​534](Effect-TS/language-service#534) ### [`v0.62.1`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0621) [Compare Source](Effect-TS/language-service@v0.62.0...v0.62.1) ##### Patch Changes - [#​532](Effect-TS/language-service#532) [`8f189aa`](Effect-TS/language-service@8f189aa) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Fix handling of read-only arrays in "Refactor to Schema (Recursive Structural)" code generation. The refactor now correctly distinguishes between mutable arrays (`Array<T>`) and read-only arrays (`ReadonlyArray<T>` or `readonly T[]`): - `Array<T>` is now converted to `Schema.mutable(Schema.Array(...))` to preserve mutability - `ReadonlyArray<T>` and `readonly T[]` are converted to `Schema.Array(...)` (read-only by default) This fixes compatibility issues with external libraries (like Stripe, BetterAuth) that expect mutable arrays in their API parameters. Fixes [#​531](Effect-TS/language-service#531) ### [`v0.62.0`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0620) [Compare Source](Effect-TS/language-service@v0.61.0...v0.62.0) ##### Minor Changes - [#​528](Effect-TS/language-service#528) [`7dc14cf`](Effect-TS/language-service@7dc14cf) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add typeToSchema codegen This adds a new `// @​effect-codegens typeToSchema` codegen that automatically generates Effect Schema classes from TypeScript types. Given a type alias with object members representing schemas to generate (e.g., `type ToGenerate = { UserSchema: User, TodoSchema: Todo }`), the codegen will create the corresponding Schema class definitions. The generated schemas: - Automatically detect and reuse existing schema definitions in the file - Support both type aliases and interfaces - Include outdated detection to warn when the source type changes - Work with the `outdatedEffectCodegen` diagnostic to provide automatic fix actions Example usage: ```typescript type User = { id: number; name: string; }; // @​effect-codegens typeToSchema export type ToGenerate = { UserSchema: User; }; // Generated by the codegen: export class UserSchema extends Schema.Class<UserSchema>("UserSchema")({ id: Schema.Number, name: Schema.String, }) {} ``` ##### Patch Changes - [#​530](Effect-TS/language-service#530) [`5ecdc62`](Effect-TS/language-service@5ecdc62) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Fix `Refactor to Schema (Recursive Structural)` to support `exactOptionalPropertyTypes` When `exactOptionalPropertyTypes` is enabled in tsconfig, optional properties with types like `string | undefined` are not assignable to types defined as `prop?: string`. This fix generates `Schema.optionalWith(Schema.String, { exact: true })` instead of `Schema.optional(Schema.Union(Schema.Undefined, Schema.String))` to maintain type compatibility with external libraries that don't always include `undefined` in their optional property types. Example: ```typescript // With exactOptionalPropertyTypes enabled type User = { name?: string; // External library type (e.g., Stripe API) }; // Generated schema now uses: Schema.optionalWith(Schema.String, { exact: true }); // Instead of: Schema.optional(Schema.Union(Schema.Undefined, Schema.String)); ``` This ensures the generated schema maintains proper type compatibility with external libraries when using strict TypeScript configurations. ### [`v0.61.0`](https://github.com/Effect-TS/language-service/blob/HEAD/CHANGELOG.md#0610) [Compare Source](Effect-TS/language-service@v0.60.0...v0.61.0) ##### Minor Changes - [#​525](Effect-TS/language-service#525) [`e2dbbad`](Effect-TS/language-service@e2dbbad) Thanks [@​mattiamanzati](https://github.com/mattiamanzati)! - Add Structural Type to Schema refactor Adds a new "Structural Type to Schema" refactor that converts TypeScript interfaces and type aliases to Effect Schema classes. This refactor analyzes the structure of types and generates appropriate Schema definitions, with intelligent detection and reuse of existing schemas. Example: ```typescript // Before export interface User { id: number; name: string; } // After (using the refactor) export class User extends Schema.Class<User>("User")({ id: Schema.Number, name: Schema.String, }) {} ``` The refactor supports: - All primitive types and common TypeScript constructs - Automatic reuse of existing Schema definitions for referenced types - Optional properties, unions, intersections, and nested structures - Both interface and type alias declarations </details> <details> <summary>Effect-TS/effect (@​effect/platform)</summary> ### [`v0.94.1`](https://github.com/Effect-TS/effect/blob/HEAD/packages/platform/CHANGELOG.md#0941) [Compare Source](https://github.com/Effect-TS/effect/compare/@effect/[email protected]...@effect/[email protected]) ##### Patch Changes - [#​5936](Effect-TS/effect#5936) [`65e9e35`](Effect-TS/effect@65e9e35) Thanks [@​schickling](https://github.com/schickling)! - Document subtle CORS middleware `allowedHeaders` behavior: when empty array (default), it reflects back the client's `Access-Control-Request-Headers` (permissive), and when non-empty array, it only allows specified headers (restrictive). Added comprehensive JSDoc with examples. - [#​5940](Effect-TS/effect#5940) [`ee69cd7`](Effect-TS/effect@ee69cd7) Thanks [@​kitlangton](https://github.com/kitlangton)! - HttpServerResponse: fix `fromWeb` to preserve Content-Type header when response has a body Previously, when converting a web `Response` to an `HttpServerResponse` via `fromWeb`, the `Content-Type` header was not passed to `Body.stream()`, causing it to default to `application/octet-stream`. This affected any code using `HttpApp.fromWebHandler` to wrap web handlers, as JSON responses would incorrectly have their Content-Type set to `application/octet-stream` instead of `application/json`. - Updated dependencies \[[`488d6e8`](Effect-TS/effect@488d6e8)]: - effect\@​3.19.14 ### [`v0.94.0`](https://github.com/Effect-TS/effect/blob/HEAD/packages/platform/CHANGELOG.md#0940) [Compare Source](https://github.com/Effect-TS/effect/compare/@effect/[email protected]...@effect/[email protected]) ##### Minor Changes - [#​5917](Effect-TS/effect#5917) [`ff7053f`](Effect-TS/effect@ff7053f) Thanks [@​tim-smart](https://github.com/tim-smart)! - support non-errors in HttpClient.retryTransient ##### Patch Changes - Updated dependencies \[[`77eeb86`](Effect-TS/effect@77eeb86), [`287c32c`](Effect-TS/effect@287c32c)]: - effect\@​3.19.13 </details> <details> <summary>Effect-TS/effect (@​effect/platform-browser)</summary> ### [`v0.74.0`](https://github.com/Effect-TS/effect/blob/HEAD/packages/platform-browser/CHANGELOG.md#0740) [Compare Source](https://github.com/Effect-TS/effect/compare/@effect/[email protected]...@effect/[email protected]) ##### Patch Changes - Updated dependencies \[[`77eeb86`](Effect-TS/effect@77eeb86), [`ff7053f`](Effect-TS/effect@ff7053f), [`287c32c`](Effect-TS/effect@287c32c)]: - effect\@​3.19.13 - [@​effect/platform](https://github.com/effect/platform)@​0.94.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi40Mi4zIiwidXBkYXRlZEluVmVyIjoiNDIuODAuMiIsInRhcmdldEJyYW5jaCI6Im5leHQiLCJsYWJlbHMiOltdfQ==--> Reviewed-on: https://git.valverde.cloud/Thilawyn/effect-fc/pulls/29 Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
HttpServerResponse.fromWebto preserve theContent-Typeheader when converting a webResponsetoHttpServerResponseBody.stream(), causing it to default toapplication/octet-streamHttpApp.fromWebHandlerto wrap web handlers (e.g., integrating third-party auth libraries like Better Auth)Test Plan
preserves response content-type header- verifies JSON responses have correct content-typepreserves custom content-type header- verifies custom content-types liketext/htmlare preservedjson preserves content-type- verifiestoWebHandlercorrectly outputs content-typeAll 175 tests pass.
Example
Before this fix, wrapping a web handler would lose the Content-Type: